import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.wb.swt.SWTResourceManager;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;


// TODO: Auto-generated Javadoc
/**
 * The Class Trainer.
 */
public class Trainer {

	/** The shell. */
	protected Shell shell;

	/**
	 * Launch the application.
	 *
	 * @param args the arguments
	 */
	public static void main(String[] args) {
		try {
			Trainer window = new Trainer();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shell.open();
		shell.layout();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shell = new Shell();
		shell.setSize(700, 500);
		shell.setText("SWT Application");
		
		Button btnNewButton = new Button(shell, SWT.NONE);
		btnNewButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				Object window;
				shell.close();
				window = new AppointmentRequest();
				((AppointmentRequest)window).open();
			}
		});
		btnNewButton.setBounds(133, 125, 154, 30);
		btnNewButton.setText("Request Appointment");
		
		Button btnManagePokemons = new Button(shell, SWT.NONE);
		btnManagePokemons.setText("Manage Pokemons");
		btnManagePokemons.setBounds(133, 179, 154, 30);
		
		Button btnViewPokemonHistor = new Button(shell, SWT.NONE);
		btnViewPokemonHistor.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				Object window;
				shell.close();
				window = new PokemonHIstory();
				((PokemonHIstory)window).open();
			}
		});
		btnViewPokemonHistor.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
			}
		});
		btnViewPokemonHistor.setText("View Pokemon History");
		btnViewPokemonHistor.setBounds(133, 227, 154, 30);
		
		//adding background
		final Display display = Display.getDefault();
		Canvas canvas = new Canvas(shell, SWT.NONE);
		canvas.addPaintListener(new PaintListener() {
			public void paintControl(PaintEvent arg0) {
					 org.eclipse.swt.graphics.Image image = new org.eclipse.swt.graphics.Image(display, "/Users/kennyha/Desktop/Eclipse Workplace/employeePage.png");
					 arg0.gc.drawImage(image, 10, 10);

				        image.dispose();
				
			}
		});
		canvas.setBounds(-14, -22, 714, 500);
		
		Button btnLogout = new Button(canvas, SWT.NONE);
		btnLogout.setBounds(150, 383, 154, 30);
		btnLogout.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseUp(MouseEvent e) {
				Object window;
				shell.close();
				window = new Main();
				((Main)window).open();
			}
		});
		btnLogout.setText("Log out");
		
				
				Label lblTrainersProfiles = new Label(canvas, SWT.NONE);
				lblTrainersProfiles.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
				lblTrainersProfiles.setBounds(178, 44, 232, 36);
				lblTrainersProfiles.setFont(SWTResourceManager.getFont("Lucida Grande", 25, SWT.BOLD));
				lblTrainersProfiles.setText("Trainer's Profile");
		

	}

}
